using System;
using Arcane.Source.Data;
using Godot;

namespace Arcane.Source.UI
{
    public partial class RuneSlot : Control
    {
        [Export]
        public TextureButton button;
        [Export]
        Label label;

        public Action<RuneSlot> OnClick;

        public void Setup(StringName id)
        {
            button.TextureNormal = GameDB.Rune.Get(id).icon;
        }

        public void OnButtonClick()
        {
            OnClick?.Invoke(this);
        }

        public void Select()
        {
            label.Text = "✓";
        }

        public void Cancel()
        {
            label.Text = string.Empty;
        }
    }
}